<template>
    <div>
        count: {{count}}
        <!-- 1.使用store.commit -->
        <button @click="$store.commit('increment', 2)"> count++ </button>
        <!--2. mapMutations  -->
        <button @click="increment(2)"> count++ </button>
        <!--3. mapMutations_别名 -->
        <button @click="incrementAlias(2)"> count++ </button>
    </div>
</template>

<script>
import { mapState, mapMutations } from 'vuex'
export default {
    name: "Mutation",
    computed:{
        ...mapState(['count'])
    },
    methods:{
        ...mapMutations(['increment']),
        ...mapMutations({incrementAlias: 'increment'})
    }
}
</script>>